package weapp

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"gitee.com/xiaofengfeng123/srv-paper-tape/database"
)


func Route(parentRoute *gin.RouterGroup){
	router := parentRoute.Group("/weapp")
	router.GET("/appcode",WeappCode)
}



func WeappCode(c *gin.Context){
	userid := c.GetString("id")
	user,_ := database.UserById(userid)
	path := fmt.Sprintf("/pages/load/load?id=%s",user.Uid)
	photo := AppCode(path)
	c.Header("Content-Type","image/png")
	c.Writer.Write(photo)


}
